<?php
	require_once( '../_config/base.inc.php' );

	use \dayscript\Application;
	use \dayscript\util\Debug;
	use \dayscript\util\Benchmark;
	use \dayscript\util\JSON;
	use \dayscript\ErrorManager;
	use \dayscript\Enviroment;
	
	Application::getInstance( BASE_DIR . '_config/tests.inc.php' );
	ErrorManager::setUproarMode( true ); // Not for production
	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<title>JSON</title>
	<link rel="stylesheet" type="text/css" media="all" href="../_resources/styles.css" />
</head>
<body>
<?php 
	function show( $var )	{
?>
<ul>
	<li><b>PHP</b>:<?php var_dump( $var ) ?></li>
	<li><b>PHP &raquo; JSON</b>:<br /><?php echo JSON::encode( $var ) ?></li>
	<li><b>JSON &raquo; PHP</b>:<?php var_dump( JSON::decode( JSON::encode( $var ) ) ) ?></li>
	<li><b>JSON &raquo; PHP (Object)</b>:<?php var_dump( JSON::decode( JSON::encode( $var ), true ) ) ?></li>
</ul>
<?php
	}
?>
<b>JSON:</b>
<hr />
<b>Arreglo:</b>
<?php
	show(array( 'a', 'b', 3, array( 1,2,3,4 ), 1.5, '1.5', false, null, 'false' ) );
?>
<hr />
<b>Objeto:</b>
<?php
	show( Enviroment::server( ) );
?>
<pre>
<b>Benchmark:</b><?php echo Benchmark::getInstance( ) ?>
</pre>
</body>
</html>